package com.qf.controller;

import com.qf.pojo.Account;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Date;

/**
 * @Description: 公用常量
 * @Data: 2022/9/3 10:46
 * @Pacakge: com.qf.controller
 * @ClassName: AccountController
 * @Author: fan
 */
@Controller
@RequestMapping("account")
public class AccountController {
    @RequestMapping(value ="findAccount",method = RequestMethod.GET)
    public String findAccount(){
        System.out.println("执行了查询账户..");
        return "success";
    }
    //params:表示请求的url必须携带指定参数
    //params:指定了参数值,请求必须携带指定的参数,指定的值才不会报错,要求我们指定的参数指定的值必须保持一致,否则会出现400--错误
    @RequestMapping(value = "addAccount",params = {"username=aa"})
    public String addAccount(){
        System.out.println("addAccount执行了...");
        return "success";
    }
    @RequestMapping(value = "findAccountById")
    public String findAccountById(Integer id){
        System.out.println("id = " + id);
        System.out.println("findAccountByID执行了...");
        return "success";
    }
    @RequestMapping(value = "findAccountByIdAndName")
    public String findAccountByIdAndName(Integer id,String name){
        System.out.println("id:"+id);
        System.out.println("name:"+name);
        System.out.println("findAccountByIDAndName执行了...");
        return "success";
    }
//    @RequestMapping(value = "addAccountByForm",method = RequestMethod.POST)
    @PostMapping(value = "addAccountByForm")
    public String addAccountByForm(Account account){
        System.out.println("account = " + account);
        System.out.println("addAccountByForm执行...");
        return "success";
    }
    @RequestMapping("deleteAccount")
    public String deleteAccount(Date date){
        System.out.println(date);
        return "success";
    }
}
